package com.dyz.leetcode._04_bitOperation;

public class _231_isPowerOfTwo {
    public boolean isPowerOfTwo(int n) {
        if(n==0){return false;}
        while(n%2==0){
            n = n/2;
        }
        return n==1;
    }
    public boolean isPowerOfTwo1(int n) {

        if(n==0){return false;}
        long x = n;
        return (x&(x-1))==0;
    }
}
